package com.xbongbong.saas.enums.dictionary;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.Objects;

/**
 * @author jiyonghui
 * @className CouponTempleteStatusEnum
 * @description
 * @date 2020/1/6   14:41
 */
@Getter
public enum CouponNumTypeEnum {
    // 适用对象类型

    NO_LIMIT("0", "enum.CouponNumTypeEnum.name.no_limit", "noLimit"),
    CUSTOM("1", "enum.CouponNumTypeEnum.name.custom", "custom"),
    ;

    private String code;
    private String name;
    private String attr;

    CouponNumTypeEnum(String code, String name, String attr) {
        this.code = code;
        this.name = name;
        this.attr = attr;
    }


    public static String getByCode(String number) {
        for (CouponNumTypeEnum marketingActivityStatusEnum : values()) {
            if (Objects.equals(marketingActivityStatusEnum.getCode(), number)) {
                return marketingActivityStatusEnum.getName();
            }
        }
        return null;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
